package com.linwen.excise.niuke._80;

import java.util.Scanner;

/**
 * @author wlw
 * @date 2023/3/17 11:55 PM
 */
public class _75公共子串计算 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String str1 = scanner.nextLine();
        String str2 = scanner.nextLine();
        System.out.println(function(str1,str2));
    }

    private static int function(String str1, String str2) {
        if(str1.length()>str2.length()){
            return function(str2,str1);
        }
        for (int i = str1.length(); i >0; i--) {
            int end = i;
            int start = 0;
            int loopCount = str1.length()-end;
            for (int j = 0; j <= loopCount; j++) {
                if(str2.contains(str1.substring(start,end))){
                    return end-start;
                }
                start++;
                end++;
            }
        }
        return 0;
    }
}
